package com.fll.course.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.fll.course.dto.CourseDto;
import com.fll.course.service.ICourseService;
import com.fll.thrift.user.dto.UserDto;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description
 * @Author fanlei
 * @Version 1.0
 * @Date 2018年09月02日
 */
@Controller
@RequestMapping("/course")
public class CourseController {

    @Reference
   private ICourseService courseService;

    @RequestMapping(value = "/courseList",method = RequestMethod.GET)
    @ResponseBody
   public List<CourseDto> courseList(HttpServletRequest request){

        UserDto userDto = (UserDto) request.getAttribute("user");
        System.out.println(userDto.toString());

       return courseService.courseList();
   }

}
